<#assign base=springMacroRequestContext.contextPath>
<!DOCTYPE html>
<html lang="en">
<head>
    <link href="${base}/static/css/select2.css" rel="stylesheet">
    <script type="text/javascript" src="${base}/static/js/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="${base}/static/js/select2.full.js"></script>
    <script type="text/javascript" src="${base}/static/js/select2.js"></script>
</head>



<body class="clickClass">
<div class="container" style=" height:1000px;width:100%">
    Select2 : <label for="c01-select"></label>
    <select id="c01-select" style="width: 150px;">
        <option></option>
    </select>
</div>
</body>
<script type="text/javascript">
    /*$("#c01-select").select2({
        ajax: {
            url: "/toSelect2Page",
            type : 'post',
            dataType: 'json',
            delay: 250,
            data: function (params) {
                return {
                    q: params.term
                };
            },
            processResults: function (data) {
                return {
                    results: data
                };
            },
            cache: true
        },
        escapeMarkup: function (markup) { return markup; },
        minimumInputLength: 1,
        templateResult: formatRepo,
        templateSelection: formatRepoSelection
    });*/
    $(document).ready(function () {
        $.ajax({
            url : '${base}/loadingRemoteData',
            type : 'post',
            dataType : 'json',
            success : function (data) {

                $("#c01-select").select2({
                    data: data,
                    placeholder:'请选择',
                    allowClear:true
                })
            },
            error : function () {
                alert("请求中断!");
            }
        });
    });

</script>
</html>